<script setup lang="ts">
import { ref, watch } from 'vue'

const totalCount = ref(10)

const msg = ref('震惊！！')

watch([totalCount,msg],(newValue,oldValue)=>{
  console.log('totalCount变化了',totalCount.value)
  console.log('newValue,oldValue',newValue,oldValue)
})


</script>


<template>
  <p>计数器：{{ totalCount }}</p>
  <button @click="totalCount++">点击+1</button>
  <button @click="msg += '!'">点击继续震惊</button>
</template>

